<?php


namespace app\models\searchs;

use yii\base\DynamicModel;
use yii\data\DataFilter;

class UserSearch extends DynamicModel implements ClientFilterInterface
{
    public $email;
    public $phone;
    public $name;
    public $type_id;
    public $is_admin;
    public $start_time;
    public $end_time;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['email', 'phone'], 'string'],
            ['start_time', 'date'],
            ['end_time', 'date']
        ];
    }

    public function filters()
    {
        return [
            'email' => ['like' => ''],
            'phone' => ['like' => '']
        ];
    }

    public function attributeLabels()
    {
        return [
            'email' => '邮箱',
            'phone' => '电话',
            'name' => '名称',
            'type_id' => '用户分类',
            'is_admin' => '管理员分类',
            'start_time' => '开始日期',
            'end_time' => '结束日期'
        ];
    }


    public function attributeTypes()
    {
        return [
            'email' => DataFilter::TYPE_STRING,
            'phone' => DataFilter::TYPE_STRING,
        ];
    }

}